home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 2 / 002.d81 / crypto helper (.txt) < prev    next >
Commodore BASIC  |  2022-08-26  |  6KB  |  245 lines

  1. 10 poke53272,21:poke783,peek(783)and254
  2. 20 poke53280,3:poke53281,1:printchr$(156):poke53272,21
  3. 30 printchr$(147):poke781,5:poke782,12:sys65520:print"cryptogram helper"
  4. 40 poke781,8:poke782,19:sys65520:print"by"
  5. 50 poke781,11:poke782,14:sys65520:print"russ  gephart"
  6. 60 poke781,19:poke782,6:sys65520:print"translated by donna k. woody"
  7. 70 poke781,23:poke782,7:sys65520:print"press space bar to continue";:
  8. 80 poke198,0:wait198,1:geta$
  9. 90 printchr$(147):print"do you need instructions (y/n)?[160]";:
  10. 100 poke198,0:wait198,1:geta$
  11. 110 ifa$="y"thengosub6500:goto1010
  12. 120 ifa$="n"then1010
  13. 130 goto90
  14. 1000 rem cryptogram program by russ gephart
  15. 1010 dimsc(26),st(26)
  16. 1020 printchr$(147):x=0
  17. 1025 v=22:sp$="                                      "
  18. 1030 printchr$(156):print:print"enter encrypted line (cr) to end"
  19. 1040 inputa$(x)
  20. 1050 ifa$(x)=""then1070
  21. 1060 x=x+1:ifx<>7then1030
  22. 1070 printchr$(147):printchr$(156)
  23. 1080 forz=0tox-1
  24. 1090 poke781,z*3+2:poke782,1:sys65520:printa$(z)
  25. 1100 nextz
  26. 1110 poke781,24:poke782,24:sys65520:print"* for submenu";
  27. 1113 poke781,v:poke782,0:sys65520
  28. 1115 printchr$(144);:print"substitute ? with ?[157][157][157][157][157][157][157][157]";:poke198,0:wait198,1:getb$
  29. 1120 ifasc(b$)=42then2000:rem *
  30. 1130 ifasc(b$)=13then1195:rem c/r
  31. 1140 printb$;spc(6):poke198,0:wait198,1:getc$
  32. 1150 ifasc(c$)=42then2000:rem *
  33. 1160 ifasc(c$)=13then1195:rem c/r
  34. 1170 printc$
  35. 1180 gosub1230:rem search & sub
  36. 1195 gosub1220
  37. 1200 goto1110
  38. 1210 rem  clear bottom lines
  39. 1220 poke781,v:poke782,0:sys65520:printsp$:printsp$:printsp$;:return
  40. 1230 rem  search & replace
  41. 1240 forz=0tox-1
  42. 1250 forzz=1tolen(a$(z))
  43. 1260 ifmid$(a$(z),zz,1)=b$thengosub1300
  44. 1270 nextzz
  45. 1280 nextz
  46. 1290 return
  47. 1300 poke781,z*3+1:poke782,zz:sys65520
  48. 1310 ifc$=" "thenprintc$:return
  49. 1320 printchr$(159);c$;chr$(144):return
  50. 1999 :
  51. 2000 rem escape routines
  52. 2001 :
  53. 2010 gosub1210
  54. 2020 poke781,v:poke782,0:sys65520:print"*=clear   e=edit   f=letter frequency"
  55. 2030 print"s=save    l=load   r=restart"
  56. 2035 print"h=help    x=exit";:poke198,0:wait198,1:geta$
  57. 2040 ifasc(a$)=42then2500
  58. 2050 ifa$="e"then3000
  59. 2060 ifa$="f"then3500
  60. 2070 ifa$="s"then4000
  61. 2080 ifa$="l"then4500
  62. 2090 ifa$="r"then5000
  63. 2095 ifa$="h"thengosub6500:goto1080
  64. 2100 ifa$="x"then5500
  65. 2110 goto1195
  66. 2499 :
  67. 2500 rem clear screen routine
  68. 2501 :
  69. 2505 printchr$(19)
  70. 2510 forz=0tox-1
  71. 2520 poke781,z*3+2:poke782,1:forc=1tolen(a$(z))+1:print" ";:nextc
  72. 2530 print:print:print:nextz
  73. 2540 goto1195
  74. 2999 :
  75. 3000 rem  edit routine
  76. 3001 :
  77. 3010 gosub1220
  78. 3020 poke781,v:poke782,0:sys65520:print"which line to re-enter";
  79. 3025 poke198,0:wait198,1:geta$
  80. 3027 a=val(a$):ifa>zora<1goto3020
  81. 3030 poke781,(a-1)*3+3:poke782,0:sys65520
  82. 3040 inputa$(a-1)
  83. 3050 gosub1210
  84. 3060 f=0
  85. 3070 goto1070
  86. 3499 :
  87. 3500 rem frequency routine
  88. 3501 :
  89. 3510 gosub1210
  90. 3520 iff=1then3740
  91. 3530 forcc=1to26:sc(cc)=0:next
  92. 3540 poke781,v:poke782,0:sys65520:print"counting letters";:
  93. 3550 forz=0tox-1
  94. 3560 forzz=1tolen(a$(z))
  95. 3570 j$=mid$(a$(z),zz,1)
  96. 3580 ifasc(j$)>=65andasc(j$)<=90thensc(asc(j$)-64)=sc(asc(j$)-64)+1
  97. 3590 nextzz
  98. 3600 nextz
  99. 3610 rem sort routine
  100. 3620 gosub1210:poke781,22:poke782,0:sys65520:print"sorting by frequency":
  101. 3630 fory=1to26:st(y)=y:next
  102. 3640 fory=1to25
  103. 3650 gosub3680
  104. 3660 nexty
  105. 3670 goto3740
  106. 3680 ifsc(y)>=sc(y+1)thenreturn
  107. 3690 j=sc(y):sc(y)=sc(y+1):sc(y+1)=j
  108. 3700 j=st(y):st(y)=st(y+1):st(y+1)=j
  109. 3710 ify=1thenreturn
  110. 3720 y=y-1
  111. 3730 goto3680
  112. 3740 gosub1210
  113. 3745 poke781,v:poke782,0:sys65520:h=0:flag=0
  114. 3750 fory=1to26
  115. 3755 ifflag>36thenv=v+1:flag=0:h=0:poke781,v:poke782,h:sys65520
  116. 3760 ifsc(y)=0then3790
  117. 3765 st$=mid$(str$(sc(y)),2)
  118. 3770 printchr$(st(y)+64);st$" ";:flag=flag+3-(sc(y)>9)
  119. 3780 nexty
  120. 3790 poke198,0:wait198,1:geta$
  121. 3800 f=1
  122. 3810 v=22:goto1195
  123. 3999 :
  124. 4000 rem save routine
  125. 4001 :
  126. 4010 gosub1220
  127. 4020 poke781,v:poke782,0:sys65520:print"save file?[160](y/n) "
  128. 4025 poke198,0:wait198,1:geta$
  129. 4030 ifa$<>"y"then1195
  130. 4040 gosub1220
  131. 4050 poke781,v:poke782,0:sys65520:input"name of file to save ";f$
  132. 4060 iff$=""then1195
  133. 4070 gosub1220
  134. 4080 poke781,v:poke782,0:sys65520:print"now saving ";f$
  135. 4090 open15,8,15,"r0:"+f$+"="+f$:gosub6000
  136. 4100 ifcz>20andcz<>62andcz<>63then4200
  137. 4110 ifcz=62then:open4,8,4,"0:"+f$+",seq,w":goto4155
  138. 4120 print"file already exists. continue (y/n)";
  139. 4130 poke198,0:wait198,1:geta$
  140. 4140 ifa$<>"y"thenclose4:close15:goto1195
  141. 4150 print#15,"s0:"+f$:open4,8,4,"0:"+f$+",seq,w"
  142. 4155 forz=0tox-1
  143. 4160 print#4,a$(z)
  144. 4165 next
  145. 4170 close4:close15
  146. 4180 goto1195
  147. 4200 print"there is a disk error #"cz"which is":printmz$
  148. 4210 print"continue (y/n)?[160]";:poke198,0:wait198,1:geta$
  149. 4220 ifa$<>"y"then1195
  150. 4230 goto4010
  151. 4499 :
  152. 4500 rem  load routine
  153. 4501 :
  154. 4510 gosub1220
  155. 4520 poke781,v:poke782,0:sys65520:print"load file? (y/n) ";
  156. 4525 poke198,0:wait198,1:geta$
  157. 4530 ifa$<>"y"then1195
  158. 4540 gosub1220
  159. 4550 poke781,v:poke782,0:sys65520:input"name of file to load ";f$
  160. 4560 iff$=""then1195
  161. 4570 gosub1220
  162. 4580 poke781,v:poke782,0:sys65520:print"now loading ";f$:ff=0
  163. 4590 open15,8,15:open4,8,4,"0:"+f$+",seq,r":gosub6000
  164. 4600 ifcz>20andcz<>62andcz<>63then4680
  165. 4610 ifcz=62thengoto4630
  166. 4620 goto4655
  167. 4625 gosub1220:poke781,v:poke782,0:sys65520
  168. 4630 print"file not found on this disk.  do you"
  169. 4635 print"want to continue (y/n)?[160]";:poke198,0:wait198,1:geta$
  170. 4640 ifa$<>"y"thenclose4:close15:goto1195
  171. 4645 close4:close15:goto4510
  172. 4655 z=0
  173. 4660 input#4,a$(z)
  174. 4665 ifst=64then4670
  175. 4667 z=z+1:goto4660
  176. 4670 close4:close15:x=z+1
  177. 4675 goto1070
  178. 4680 gosub1220:poke781,v:poke782,0:sys65520:print"there is a disk error #"
  179. 4682 printcz" which is"
  180. 4685 printmz$tab(len(mz$)+2)"continue (y/n)?[160]";:poke198,0:wait198,1:geta$
  181. 4690 ifa$<>"y"then1195
  182. 4695 goto4510
  183. 4999 :
  184. 5000 rem  restart program
  185. 5001 :
  186. 5010 clr:goto1010
  187. 5500 rem exit program
  188. 5510 printchr$(147)
  189. 5520 print"[147]load"chr$(34)"payload"chr$(34)",8":print"run"
  190. 5530 poke631,13:poke632,13:poke198,2
  191. 5540 end
  192. 5997 :
  193. 5998 rem dos error check
  194. 5999 :
  195. 6000 input#15,cz,mz$,tz,sz:return
  196. 6497 :
  197. 6498 rem  instructions
  198. 6499 :
  199. 6500 printchr$(147):poke53272,23:printchr$(156)
  200. 6510 print"     [215]elcome to [195][210][217][208][212][207][199][210][193][205] [200][197][204][208][197][210]":print:print
  201. 6520 print"  [215]ith this program, you'll be able to":print
  202. 6530 print"solve cryptogram puzzles without":print
  203. 6540 print"wearing a hole in the paper!":print
  204. 6550 print"  [217]ou have the option of entering up to":print
  205. 6560 print"7 lines of coded text.  [212]hen you can":print
  206. 6570 print"substitute one letter for another until":print
  207. 6580 print"you solve the puzzle."
  208. 6590 poke781,23:poke782,0:sys65520:print"[208][210][197][211][211][160][211][208][193][195][197][160][194][193][210][160][212][207][160][195][207][206][212][201][206][213][197]";:
  209. 6595 poke198,0:wait198,1:geta$
  210. 6600 printchr$(147):print"    [193] '*' entered when you are asked":print
  211. 6610 print"for a letter, will give you a sub-menu.":print
  212. 6620 print"[200]ere are the options you will have:":print
  213. 6630 print"     * = [195][204][197][193][210] all gusses from the"
  214. 6640 print"         screen, but leave the text":print
  215. 6650 print"     [197] =[160][197][196][201][212] a line of text you have"
  216. 6660 print"         entered (correct any typos"
  217. 6670 print"         with this function)":print
  218. 6680 print"     [198][160]=[160][204][197][212][212][197][210][160][198][210][197][209][213][197][206][195][217] will tell you"
  219. 6690 print"         how many times each letter of"
  220. 6700 print"         the encrypted text appears."
  221. 6710 print"         [212]he first time this is used,"
  222. 6720 print"         it takes a while, so be"
  223. 6725 print"         patient."
  224. 6770 poke781,23:poke782,0:sys65520:print"[208][210][197][211][211][160][211][208][193][195][197][160][194][193][210][160][212][207][160][195][207][206][212][201][206][213][197]";:
  225. 6775 poke198,0:wait198,1:geta$
  226. 6776 printchr$(147)
  227. 6780 print"     [211][160]=[160][211][193][214][197] encrypted text so you can"
  228. 6790 print"         work on it later.  [212]he 64 will"
  229. 6800 print"         check to see if the file"
  230. 6810 print"         already exists on disk.":print
  231. 6820 print"     [204][160]= [204][207][193][196] a file from disk.":print
  232. 6830 print"     [210][160]= [210][197][211][212][193][210][212] the program.  [217]ou will"
  233. 6840 print"         be able to enter new text."
  234. 685